<?php
    session_start();
    if(isset($_SESSION['username'])){
        header("location:back.php");
    }
?>



<!-- saved from url=(0032)http://temporary.com/admin/login -->
<html class=" js flexbox canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths" lang="" style=""><!--<![endif]--><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title> 澳乐汀后台</title>
        <link rel="icon" type="image/ico" href="http://temporary.com/static/images/favicon.ico">
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
      
        <!-- vendor css files -->
        <link rel="stylesheet" href="css\bootstrap.min.css">
        <link rel="stylesheet" href="css\animate.css">
        <link rel="stylesheet" href="css\font-awesome.min.css">
        <script src="js/jquery-1.8.3.min.js" type="text/javascript"></script>
        <script src="js/jquery.SuperSlide.2.1.1.js"></script>
        <script src="js/uaredirect.js"></script>
        <script type="text/javascript" src="/layer/layer.js"></script>

        <!-- project main css files -->
        <link rel="stylesheet" href="css\main.css">
        <!--/ stylesheets -->



    <style type="text/css">.jqstooltip { position: absolute;left: 0px;top: 0px;visibility: hidden;background: rgb(0, 0, 0) transparent;background-color: rgba(0,0,0,0.6);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";color: white;font: 10px arial, san serif;text-align: left;white-space: nowrap;padding: 5px;border: 1px solid white;z-index: 10000;}.jqsfield { color: white;font: 10px arial, san serif;text-align: left;}</style></head>





    <body id="minovate" class="appWrapper device-lg scheme-default default-scheme-color header-fixed aside-fixed rightbar-hidden">



        <div id="wrap" class="animsition fade-in" style="animation-duration: 1.5s;">

            <div class="page page-core page-login">

                <div class="text-center"><h3 class="text-light text-white"><img src="css\logo.png" alt="TP5 Admin Tpl " width="175" height="68"></h3></div>

                <div class="container w-420 p-15 bg-white mt-40 text-center">

                   
                    <h2 class="text-light">管理员登陆</h2>

                    <div class="form-group">
                        <input type="text" autocomplete="off" class="form-control" placeholder="管理员账号" id="username"  >
                    </div>

                    <div class="form-group">
                        <input type="password" autocomplete="off" class="form-control" placeholder="密码" id="password">
                    </div>
                    
                    <div class="form-group" style="text-align:right;">
                        <img style="float: right;" id="validate_img"   title="点击刷新" src="/validate/captcha.php" align="absbottom" onclick="this.src='/validate/captcha.php?'+Math.random();"></img>
                        <input style="width:100px;" type="text" autocomplete="off" class="form-control" placeholder="验证码" id="validate" >
                    </div>
                    <div class="form-group text-left mt-20">
                        <input type="hidden" class="form-control" name="redirect" value="">
                        <input type="submit" class="btn btn-blue b-0 br-2 mr-5" onclick="login()" name="login_submit" value="登录">
                        <a href="./" class="pull-right mt-10">忘记密码?</a>
                    </div>
                  
                </div>

            </div>



        </div>
        <!--/ Application Content -->

</body>
<script>
    function login(){
        var username=document.getElementById("username").value;
        var password=document.getElementById("password").value;
        var validate=document.getElementById("validate").value;
        if(username=="" || password=="" || validate==""){
            alert("不能为空！");
            return false;
        }
        $.post(
            "controler.php",
            {
                handle:"login",
                username:username,
                password:password,
                validate:validate
            },
            function (msg) {
                var data=msg.split("||");
                if(data.length<2){
                    layer.alert("请求出错！请联系管理员");
                }
                else{

                }
                if(data[0]==1){
                    location.href="back.php";
                }
                 else{
                     layer.alert(data[1]);
                    document.getElementById("validate_img").src='/validate/captcha.php?'+Math.random();
                    document.getElementById("validate").value="";
                 }         
            }
        )
    }
</script>
</html>